package com.ajhlp.app.phoneDetailQuery.controller;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.filter.GenericFilterBean;

import com.ajhlp.app.phoneDetailQuery.service.SystemConfigModifyService;

public class CheckSystemConfigFilter extends GenericFilterBean {

	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException {
		// TODO Auto-generated method stub
		
		if(!SystemConfigModifyService.isAllConfigExist()){
		
			((HttpServletResponse) response).sendRedirect(
					((HttpServletRequest)request).getContextPath()+"/config");
			return;
		}
		chain.doFilter(request, response);
	}

	

}
